package com.penjin.android.activity.geren;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.google.zxing.client.result.VINParsedResult;
import com.penjin.android.R;
import com.penjin.android.activity.regist.RegistLawActivity;
import com.penjin.android.utils.ToastHelper;
import com.penjin.android.view.TitleBarView;

import cn.sharesdk.framework.ShareSDK;
import cn.sharesdk.onekeyshare.OnekeyShare;

/**
 * Created by maotiancai on 2015/12/19.
 */
public class BanbenInfoActivity extends Activity implements View.OnClickListener {

    private View grade;
    private View welcome;
    private View function;
    private View treaty;
    private View privacy;
    private View copyright;
    private View update;

    TitleBarView titleBarView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.layout_activity_banbeninfo);
        init();
        showShare();

    }

    private void showShare() {
        ShareSDK.initSDK(this);
        OnekeyShare onekeyShare = new OnekeyShare();
        onekeyShare.disableSSOWhenAuthorize();
        onekeyShare.setTitle("Share SDK Test !");
        onekeyShare.setTitleUrl("http://sharesdk.cn");
        onekeyShare.setText("fengjw test");
        onekeyShare.setUrl("http://sharesdk.cn");
        onekeyShare.setComment(" test");
        onekeyShare.setImageUrl("");

        onekeyShare.setSite("test");
        onekeyShare.setSiteUrl("http://sharesdk.cn");
        onekeyShare.show(this);
    }

    private void init() {
        titleBarView = (TitleBarView) findViewById(R.id.titleBarView);
        titleBarView.setTitleBarListener(new TitleBarView.TitleBarListener() {
            @Override
            public void left(View view) {
                finish();
            }

            @Override
            public void center(View view) {

            }

            @Override
            public void right(View view) {

            }
        });
        grade = findViewById(R.id.banbenInfo_grade);
        welcome = findViewById(R.id.banbenInfo_welcome);
        function = findViewById(R.id.banbenInfo_function);
        treaty = findViewById(R.id.banbenInfo_treaty);
        privacy = findViewById(R.id.banbenInfo_privacy);
        copyright = findViewById(R.id.banbenInfo_copyright);
        update = findViewById(R.id.banbenInfo_update);

        grade.setOnClickListener(this);
        welcome.setOnClickListener(this);
        function.setOnClickListener(this);
        treaty.setOnClickListener(this);
        privacy.setOnClickListener(this);
        copyright.setOnClickListener(this);
        update.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.banbenInfo_update:
                ToastHelper.showMessage("暂无更新", getApplicationContext());
                break;
            case R.id.banbenInfo_privacy:
                Intent privacyIntent = new Intent(this, RegistLawActivity.class);
                startActivity(privacyIntent);
                break;
        }
    }
}
